﻿@using PagedList;
@using PagedList.Mvc

@model IPagedList<SILAS.Entidades.Ciudadano>

@{
    ViewBag.Title = "ListarCiudadanos";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@section css{

<link href="@Url.Content("~/Content/PagedList.css")" rel="stylesheet" type="text/css" />

}



<h2>Gestión de Ciudadanos</h2>

<p>
    @Html.ActionLink("Crear Nuevo", "Create")
</p>
<table>
    <tr>
        <th></th>
        
        <th>
            Nombres
        </th>
        <th>
            ApPaterno
        </th>
        <th>
            ApMaterno
        </th>
        <th>
            DNI
        </th>
        <th>
            Sexo
        </th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @* id=item.PrimaryKey *@
            @Html.ActionLink("Edit", "Edit", new { id = item.Id }) |
            @Html.ActionLink("Details", "Details", new { id = item.Id }) |
            @Html.ActionLink("Delete", "Delete", new { id = item.Id }, new { onClick = "return confirm('¿Está seguro de querer eliminar este ciudadano?');" })
        </td>
        
        <td>
            @item.Nombres
        </td>
        <td>
            @item.ApPaterno
        </td>
        <td>
            @item.ApMaterno
        </td>
        <td>
            @item.DNI
        </td>
        <td>
            @if (item.Sexo == "F")
            {
               <span>Femenino</span>
            }
            else
	        {
                <span>Masculino</span>        
	        }
        </td>

        
    </tr>
}

</table>
<div>
    @Html.PagedListPager(Model, page => Url.Action("ListarCiudadanos", new { page })) 
</div>


